﻿//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------

using System;
using System.Diagnostics;
using System.IO;
using UnityEditor;
using UnityEngine;

namespace Core.Editor
{
    /// <summary>
    /// 打开文件夹相关的实用函数。
    /// </summary>
    public static class OpenFolder
    {
        
        [MenuItem("HotCore/打开目录/资源包构建输出根目录", priority = 201)]
        private static void OpenAssetBundleOutputPath()
        {
            EditorUtil.OpenDirectory(BuildConfigSO.Instance.OutputRootDirectory);
        }


        [MenuItem("HotCore/打开目录/只读区（StreamingAssetsPath）", priority = 202)]
        private static void OpenReadOnlyPath()
        {
            EditorUtil.OpenDirectory(Application.streamingAssetsPath);
        }

        [MenuItem("HotCore/打开目录/读写区（PersistentDataPath）", priority = 203)]
        private static void OpenReadWritePath()
        {
            EditorUtil.OpenDirectory(Application.persistentDataPath);
        }
        
        [MenuItem("HotCore/打开目录/临时缓存（TemporaryCachePath）", priority = 204)]
        private static void OpenTemporaryCachePath()
        {
            EditorUtil.OpenDirectory(Application.temporaryCachePath);
        }
        
        /// <summary>
        /// 打开 Console Log Path 文件夹。
        /// </summary>
        [MenuItem("HotCore/打开目录/控制台日志（ConsoleLogPath）", false, 205)]
        public static void OpenConsoleLogPath()
        {
            EditorUtil.OpenDirectory(Path.GetDirectoryName(Application.consoleLogPath));
        }
    }
}